Public Class FormSetting

    Private Sub FormSetting_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed
        Dim m_BCReaderManager As CCasioDTX7 = New CCasioDTX7()
        m_BCReaderManager.SetInputMode(CCasioDTX7.EnumInputMode.INPUT_LOCK_NUM)
        m_BCReaderManager = Nothing

    End Sub

    Private Sub FormSetting_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim m_BCReaderManager As CCasioDTX7 = New CCasioDTX7()
        m_BCReaderManager.SetInputMode(CCasioDTX7.EnumInputMode.INPUT_NORMAL)
        m_BCReaderManager = Nothing


        'Me.UniqueMonthCombo.SelectedIndex = 0
        Dim manager As CApplicationManager = CApplicationManager.GetInstance()
        Dim data As CApplicationSettings = manager.GetAppSettings()
        SetWindowData(data)

    End Sub

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <param name="data"></param>
    ''' <remarks></remarks>
    Public Sub SetWindowData(ByVal data As CApplicationSettings)
        With data
            ServerAddressTextBox.Text = .ServerAddress
            UserIdTextBox.Text = .UserId
            UserPasswordTextBox.Text = .UserPassword
            PdaCdTextBox.Text = .PdaCd
            UniqueCdSave.Text = .UniqueCdCount
            ShipCdSave.Text = .ShipCdCount
            SendCount.Text = .SendCount

            If .OverCountMsg Then
                OverCountMsg.Checked = True
            Else
                OverCountMsg.Checked = False
            End If

            If .IsStaticReadEmpCd Then
                StaticEmp.Checked = True
            Else
                StaticEmp.Checked = False
            End If
        End With
    End Sub

    Private Sub SaveButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveButton.Click
        Dim manager As CApplicationManager = CApplicationManager.GetInstance()
        Dim data As CApplicationSettings = manager.GetAppSettings()

        With data
            .ServerAddress = ServerAddressTextBox.Text
            .UserId = UserIdTextBox.Text
            .UserPassword = UserPasswordTextBox.Text
            .PdaCd = PdaCdTextBox.Text
            .UniqueCdCount = UniqueCdSave.Text
            .ShipCdCount = ShipCdSave.Text
            .SendCount = SendCount.Text

            If OverCountMsg.Checked = True Then
                .OverCountMsg = True
            Else
                .OverCountMsg = False
            End If

            If StaticEmp.Checked = True Then
                .IsStaticReadEmpCd = True
            Else
                .IsStaticReadEmpCd = False
            End If

        End With
        CApplicationManager.SaveToXmlFile(data)

        Me.Close()
    End Sub

    Private Sub CancelButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CancelButton.Click
        Me.Close()
    End Sub

    Private Sub FormSetting_Closing(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
        Me.Dispose()
    End Sub

End Class